<?php
class CV_ORM_Schema_Writer_SeparateFile_ObjectAccess{
	public function __construct( $pdo ){
		$this->arrayAccess = new $this->arrayAccessClass( $pdo );
	}
	public function get( $id ){
		return $this->toObject( $this->arrayAccess->get($id) );
	}
	public function update( $object ){
		 $this->arrayAccess->update( $this->toArray($object) );
	}
	public function insert( $object ){
		 $this->arrayAccess->insert( $this->toArray($object) );
	}
	protected function toArray( $object ){
		return $object->_getState();
	}
	protected function toObject( $array ){
		return new $this->modelClass( $array );
	}
	protected function sqlSelect( $where, $args = array() ){
		$arrays = $this->arrayAccess->sqlSelectMany( $where, $args );
		return array_map( array($this,'toObject'), $arrays );
	}
}